package com.xunua.networkproject.Retrofit;

import com.xunua.networkproject.RetrofitBean.CommentBean;
import com.xunua.networkproject.RetrofitBean.CommentResultBean;
import com.xunua.networkproject.RetrofitBean.PostFileResultBean;

import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * @user XUNUA
 * @email xunua@outlook.com
 * @creat time 2020/5/7 9:34
 */
public interface RetrofitService {
    @GET("/get/text")       //get请求
    Call<String> getText();
    @GET("/get/param")      //get带参数请求
    Call<RetrofitServiceImp.ParamBean> getParam(@Query("keyword")String keyword,@Query("page")String page,@Query("order") int order);
    @GET("/get/param")      //get带参数请求 map
    Call<RetrofitServiceImp.ParamBean> getParam(@QueryMap Map<String,Object> params);

    @POST("/post/string")       //post请求uri带参
    Call<String> postString(@QueryMap Map<String,Object> map);
    @POST       //post请求uri带参
    Call<String> postString(@Url String url);
    @POST("/post/comment")          ///post  json请求
    Call<CommentResultBean> postComment(@Body CommentBean commentBean);
    @Multipart
    @POST("/file/upload")//上传单个文件
    Call<PostFileResultBean> postFile(@Part MultipartBody.Part part, @Header("token")String token);
    @Multipart
    @Headers({"token:alsasfasfsafas","client:android"})
    @POST("/files/upload")//上传多个文件
    Call<PostFileResultBean> postFiles(@Part List<MultipartBody.Part> parts);
    @Multipart
    @POST("/file/params/upload")//带参数的文件上传
    Call<PostFileResultBean>  postFileParams(@Part MultipartBody.Part part, @PartMap Map<String,String> params, @HeaderMap Map<String,String> map);
    @POST("/login")     //post 表单请求
    @FormUrlEncoded
    Call<PostFileResultBean> postLogin(@Field("userName")String name,@Field("password")String pwd);
    @GET
    @Streaming
    Call<ResponseBody> download(@Url String url);
}
